package com.huaxin.hxmoduleworkorder.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huaxin.hxmoduleworkorder.dto.request.MaintenanceOrderElectricianTaskPageListReqDTO;
import com.huaxin.hxmoduleworkorder.dto.response.MaintenanceOrderElectricianTaskSummaryRespDto;
import com.huaxin.hxmoduleworkorder.models.MaintenanceOrderElectricianTask;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface MaintenanceOrderElectricianTaskMapper extends BaseMapper<MaintenanceOrderElectricianTask> {
    /**
     * 查询某电工的所有未完成任务
     */
    List<MaintenanceOrderElectricianTaskSummaryRespDto> selectIncompleteTasksByElectricianId(@Param("electricianId") String electricianId,
                                                                                             @Param("incompleteTaskStatusCodes") List<String> incompleteTaskStatusCodes,
                                                                                             @Param("terminalOrderStatusCodes") List<String> terminalOrderStatusCodes);

    Page<MaintenanceOrderElectricianTaskSummaryRespDto> selectPageTasks(IPage<MaintenanceOrderElectricianTaskSummaryRespDto> page, @Param("req") MaintenanceOrderElectricianTaskPageListReqDTO req);

    Map<String, Long> incompleteTaskCountByElectrician(@Param("incompleteTaskStatusCodes") List<String> incompleteTaskStatusCodes);
}